﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AtletIS.Shared.WpfControls
{
    /// <summary>
    /// Interaction logic for ResultBox.xaml
    /// </summary>
    public partial class ResultBox : UserControl
    {
        public ResultBox(int nOrder, int nStartNumber, string sCountry, string sName, string sResult, string sReaction, string sPbSb)
        {
            InitializeComponent();

            if (nOrder == 0)
                txtOrder.Text = string.Empty;
            else
                txtOrder.Text = nOrder.ToString();

            string sFilePath = AppDomain.CurrentDomain.BaseDirectory;
            sFilePath = System.IO.Path.Combine(sFilePath, "Ext", "Flags", "24px", sCountry + ".png");
            if (System.IO.File.Exists(sFilePath))
            {
                BitmapImage flag = new BitmapImage();
                flag.BeginInit();
                flag.UriSource = new Uri(sFilePath);
                flag.EndInit();
                iCountry.Source = flag;
            }

            if (nStartNumber == 0)
                txtStartNumber.Text = string.Empty;
            else
                txtStartNumber.Text = "(" + nStartNumber.ToString() + ")";
            
            txtName.Text = sName;

            // Reaction
            if (sReaction == string.Empty)
            {
                spReact.Visibility = System.Windows.Visibility.Hidden;
            }
            else
            {
                spReact.Visibility = System.Windows.Visibility.Visible;
                txtReaction.Text = sReaction;
            }

            // Result
            txtResult.Text = sResult;

            // PB, SB
            if (sPbSb == string.Empty)
            {
                borPbSb.Visibility = System.Windows.Visibility.Hidden;
            }
            else
            {
                borPbSb.Visibility = System.Windows.Visibility.Visible;
                txtPbSb.Text = sPbSb;
            }
        }









    }
}
